package joapp

type AppCmdHandler func()

type AppCmd struct {
	AppFlagCmdBase
	handler AppCmdHandler
}

func NewAppCmd(handler AppCmdHandler, name, usage string) *AppCmd {
	if handler == nil {
		panic("can not create AppCmd with nil handler")
	}

	cmd := new(AppCmd)
	cmd.Init(name, usage)
	cmd.handler = handler
	return cmd
}

func (cmd *AppCmd) GetHandler() AppCmdHandler {
	return cmd.handler
}
